﻿using Youz.Common.BLL;
using Youz.Common.Helper;
using Youz.CreditRepay.BLL;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Youz.CreditRepay.Entity;
using System.IO;

namespace Youz.CreditRepay.Server
{
    public partial class test : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            Dictionary<int, decimal> list = new Dictionary<int, decimal>();
            decimal total = 1000;
            decimal amount = 100;
            decimal balance = 0;

            //while (balance < total)
            //{
            //    amount * 0.8
            //}
        }

        //protected void btn_click(object sender, EventArgs e)
        //{
        //    ClassHmac2003.ClassHmac cc = new ClassHmac2003.ClassHmac();
        //    string mm = txt.Text; //v_oid_ + v_pstatus_ + v_pstring_ + v_pmode_;
        //    string md5info = cc.hex_hmac_md5(mm, "9FACC200F1264CEC");//test密钥

        //    Response.Write(md5info);
        //}

        public bool IsAllowedExtension(HttpPostedFile fu)
        {
            int fileLen = fu.ContentLength;
            byte[] imgArray = new byte[fileLen];
            fu.InputStream.Read(imgArray, 0, fileLen);
            MemoryStream ms = new MemoryStream(imgArray);
            System.IO.BinaryReader br = new System.IO.BinaryReader(ms);
            string fileclass = "";
            byte buffer;
            try
            {
                buffer = br.ReadByte();
                fileclass = buffer.ToString();
                buffer = br.ReadByte();
                fileclass += buffer.ToString();
            }
            catch
            {
            }
            br.Close();
            ms.Close();
            //注意将文件流指针还原
            fu.InputStream.Position = 0;
            
            Response.Write(Int32.Parse(fileclass));

            return false;
        }
    }
}